using System;

namespace ValidationAspects.Exceptions
{
	public class ValidateIsDateException : ValidationException
	{
		public static Func<ValidateIsDateException, string> MessageFormat { get; set; }

		static ValidateIsDateException()
		{
			ResetMessageFormat();
		}

		public ValidateIsDateException(string format, string value)
		{
			Format = format;
			Value = value;
		}

		public static void ResetMessageFormat()
		{
			MessageFormat = e => string.Format("{0} is not a valid date ({1}).", e.GetValidationTargetName(), e.Format);
		}

		public override string Message
		{
			get { return MessageFormat(this); }
		}

		public string Value { get; private set; }
		public string Format { get; private set; }
	}
}